package com.lejin.mapper;

import com.lejin.entity.ESCourse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface CourseMapper {

    @Select("" +
            "  SELECT course_outline.outline_id,\n" +
            "            course_outline.outline_name,\n" +
            "            course_outline.outline_image,\n" +
            "\t\t\t\t\t\tcat1.course_cat_id cat1id,\n" +
            "            cat1.course_name cat1name,\n" +
            "\t\t\t\t\t\tcat2.course_cat_id cat2id,\n" +
            "            cat2.course_name cat2name,\n" +
            "            course_outline.price\n" +
            "            FROM course_outline \n" +
            "            left JOIN course_cat cat1 \n" +
            "            ON cat1.course_cat_id=course_outline.category1_id\n" +
            "            LEFT JOIN course_cat cat2\n" +
            "            ON cat2.course_cat_id=course_outline.category2_id\n" +
            "            "

    )

    public List<ESCourse> findCourseCat();
}
